import {request} from '@umijs/max';
import * as API from "@/services";


/** 期刊订阅计划 分页检索请求 */
export async function queryJournalSubscribePlans(params?: API.JournalSubscribePlanPageQueryParams): Promise<API.RespPageResult<API.JournalSubscribePlan>> {
  return request('/api/v1/journal-subscribe-plan', {
    params,
  });
}

/** 期刊订阅计划 详情请求 */
export async function queryJournalSubscribePlan(bizId: API.EntityId): Promise<API.RespResult<API.JournalSubscribePlan>> {
  return request(`/api/v1/journal-subscribe-plan/${bizId}`);
}

/** 期刊订阅计划 创建请求 */
export async function createJournalSubscribePlan(entity: API.JournalSubscribePlan_Create): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-subscribe-plan`, {
    method: 'POST',
    data: entity,
  });
}

/** 期刊订阅计划 修改请求 */
export async function modifyJournalSubscribePlan(entity: API.JournalSubscribePlan_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-subscribe-plan/${entity.id}`, {
    method: 'PUT',
    data: entity,
  });
}

/** 期刊订阅计划 修改(部分)请求 */
export async function patchJournalSubscribePlan(entity: API.JournalSubscribePlan_Patch): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-subscribe-plan/${entity.id}`, {
    method: 'PATCH',
    data: entity,
  });
}

/** 期刊订阅计划 删除请求 */
export async function deleteJournalSubscribePlan(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-subscribe-plan/${bizId}`, {
    method: 'DELETE',
  });
}

/** 期刊订阅计划 批量删除请求 */
export async function deleteJournalSubscribePlans(bizIds: API.EntityId[]): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-subscribe-plan`, {
    method: 'DELETE',
    data: {
      ids: bizIds,
    },
  });
}


/** 期刊订阅计划 启用 */
export async function enableJournalSubscribePlan(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-subscribe-plan/enable/${bizId}`, {
    method: 'PUT',
  });
}

/** 期刊订阅计划 禁用 */
export async function disableJournalSubscribePlan(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-subscribe-plan/disable/${bizId}`, {
    method: 'PUT',
  });
}
